package com.hainatong.jcmvvmbase.login.fragment;

import android.view.View;
import com.blankj.utilcode.util.ToastUtils;
import com.hainatong.jcmvvmbase.Constants;
import com.hainatong.jcmvvmbase.MvvmLazyFragment;
import com.hainatong.jcmvvmbase.R;
import com.hainatong.jcmvvmbase.databinding.FragmentHandlePwdBinding;
import com.hainatong.jcmvvmbase.widget.passwardview.FinishInputPassword;
import com.hainatong.jcmvvmbase.widget.passwardview.PassWordFragment;
import com.hainatong.mvvmbase.base.NoViewModel;
import com.hainatong.mvvmbase.rxbus.RxBus;
import com.hainatong.mvvmbase.rxbus.RxBusBaseMessage;

public class HandlePwdFragment extends MvvmLazyFragment<FragmentHandlePwdBinding, NoViewModel>
{

    @Override
    public int getLayoutId()
    {
        return R.layout.fragment_handle_pwd;
    }

    @Override
    public int getBindingVariable()
    {
        return 0;
    }

    @Override
    protected void onRetryBtnClick()
    {
    }

    @Override
    protected void initView(View view)
    {
        viewDataBinding.btnSubmit.setOnClickListener( v -> {

            //显示输入密码框
            PassWordFragment.newInstace(new FinishInputPassword() {
                @Override
                public void finishPassword(String password)
                {
                    ToastUtils.showShort( password );
                    RxBus.getDefault().post(Constants.PWD_SUCCESS_CODE , new RxBusBaseMessage(2,"2"));
                }

                @Override
                public void clickForgetPassword()
                {
                    ToastUtils.showShort( "忘记密码" );
                }
            }).show(getParentFragmentManager(),"PassWordFragment");


        } );
    }
}
